package cn.yunbamboos.token;

import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

public class TokenContainer implements ITokenContainer{

    private final Map<String, String> tokens = new ConcurrentHashMap<>();

    @Override
    public Optional<String> get(String id) {
        return Optional.ofNullable(tokens.get(id));
    }

    @Override
    public void set(String id, String token) {
        tokens.put(id, token);
    }

    @Override
    public void remove(String id){
        this.tokens.remove(id);
    }
}
